home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / ctutor2.zip / TWOWAY.C < prev    next >
C/C++ Source or Header  |  1987-07-04  |  727b  |  25 lines

  1.                                         /* Chapter 8 - Program 3 */
  2. main()
  3. {
  4. int pecans,apples;
  5.  
  6.    pecans = 100;
  7.    apples = 101;
  8.    printf("The starting values are %d %d\n",pecans,apples);
  9.  
  10.                            /* when we call "fixup"          */
  11.    fixup(pecans,&apples);  /* we take the value of pecans   */
  12.                            /* we take the address of apples */
  13.  
  14.    printf("The ending values are %d %d\n",pecans,apples);
  15. }
  16.  
  17. fixup(nuts,fruit)             /* nuts is an integer value   */
  18. int nuts,*fruit;              /* fruit points to an integer */
  19. {
  20.    printf("The values are %d %d\n",nuts,*fruit);
  21.    nuts = 135;
  22.    *fruit = 172;
  23.    printf("The values are %d %d\n",nuts,*fruit);
  24. }
  25.